<!-- directive:title NG指令详解 -->
<!-- directive:breadcrumb NG指令详解 -->
<div class="panel-body">
    <div class='panel panel-default'>
        <div class='panel-heading'> [2019-10-22 16:10:16最新] AngularJs Filter自定义过滤器控制ng-repeat去除重复 </div>
        <div class='panel-body'>
            <article class="docs-content">
                <p>有一个应用场景 一系列数据循环 匹配上的内容才显示 但系统给的过滤器只有一个条件</p>
                <script type="text/xianjs" ui-bs>
                    <span ng-repeat="row in arr14 | filter: {name: 'i'} track by $index "> {{row.name}}</span>
                </script>
                <p>结果是</p>
                <p><span ng-repeat="row in arr14 | filter: {name: 'i'} track by $index "> {{row.name}}</span></p>
                <p>现在我要自己写一个过滤器方法 使一系列数据匹配一堆条件 (暂时不在模糊匹配)</p>
                <script type="text/xianjs" ui-bs>
                    <span ng-repeat="row in arr14 | inArray:dd3:'name' track by $index "> {{row.name}}</span>
                </script>
                <input type="text" class="form-control" placeholder="请输入内容" ng-model="dd3"/>
                <p>结果是</p>
                <p><span ng-repeat="row in arr14 | inArray:dd3:'name' track by $index "> {{row.name}}</span></p>
            </article>
        </div>
    </div>
    <div class='panel panel-default'>
        <div class='panel-heading'> ng-repeat 指令 输出 n 个 span </div>
        <div class='panel-body'>
            <article class="docs-content">
                <p>
                    <script type="text/xianjs" ui-bs>
                        |-1<span ng-repeat="row in (Array(10)) track by $index">|{{$index}}</span>|10|
                    </script>
                </p>
                <p>不能执行,解决不了? 凑合一下吧</p>
                <p>
                    <script type="text/xianjs" ui-bs>
                        |-1<span ng-repeat="row in arr01 track by $index">|{{$index}}</span>|10|
                    </script>
                </p>
                <p>|-1<span ng-repeat="row in arr01 track by $index">|{{$index}}</span>|10|</p>
                <p>arr01 = {{arr01}}</p>
            </article>
        </div>
    </div>
    <div class='panel panel-default'>
        <div class='panel-heading'> ng-repeat 指令 根据数字输出评价 </div>
        <div class='panel-body'>
            <article class="docs-content">
                <p>
                    ng-repeat输出 n 个 星星
                    <i ng-repeat="row in arr11 track by $index" class="fa fa-star"></i>
                    <i ng-if="arr12" class="fa fa-star-half-empty"></i>
                    <i ng-repeat="row in arr13 track by $index" class="fa fa-star-o"></i>
                    x = 3.5
                </p>
            </article>
        </div>
    </div>
    <div class='panel panel-default'>
        <div class='panel-heading'> ng-repeat 指令  完成事件(指令) </div>
        <div class='panel-body'>
            <article class="docs-content">
                <p><del>旧的想法并且已经实现</del><code>我擦擦擦 其实不用这么麻烦的</code></p>
                <script type="text/xianjs" ui-bs>
                    <span ng-repeat="row in arr01 track by $index" repeat-finish="renderFinish()">{{$index}}</span>
                    app.directive('ngRepeatFinish',function(){
                        return {
                            link: function(scope,element,attr){
                                if(scope.$last == true){ scope.$eval( attr.ngRepeatFinish ) }
                            }
                        }
                    })
                </script>
                <p>|-1<span ng-repeat="row in arr01 track by $index" ng-init="$last&&renderFinish()">|{{$index}}</span>|10| Finish ? {{renderFlag}}</p>
                <script type="text/xianjs" ui-bs>
                    <span ng-repeat="row in arr01 track by $index" ng-init="$last&&renderFinish()">|{{$index}}</span>
                </script>
            </article>
        </div>
    </div>
    <div class='panel panel-default'>
        <div class='panel-heading'> ng-repeat 指令 filter匹配字段 </div>
        <div class='panel-body'>
            <article class="docs-content">
                <p><span ng-repeat="row in arr14 | filter: {name: 'i'} track by $index "> {{row.name}}</span></p>
                <script type="text/xianjs" ui-bs>
                    <span ng-repeat="row in arr14 | filter: {name: 'i'} track by $index "> {{row.name}}</span>
                </script>
            </article>
        </div>
    </div>
    <div class='panel panel-default'>
        <div class='panel-heading'> 双层 ng-repeat 传值使用 随时用数组源 </div>
        <div class='panel-body'>
            <article class="docs-content">
                <div ng-repeat="row in arr55 ">
                    <span>time: {{row.time}}</span>
                    <br />
                    <p ng-repeat="row2 in row.data ">
                        time: {{row.time}} / opt: {{row2.name}} / {{row2.age}} / {{row.data[0].name}}
                    </p>
                </div>
            </article>
        </div>
    </div>
</div>


